<?php

class DocumentStore extends ORDataObject{
	var $document_store_id = '';
	var $medical_record_id = '';
	var $_table = 'document_store';
	var $_key = 'document_store_id';
	var $_internalName='DocumentStore';	

	function DocumentStore($id='') {
		parent::ORDataObject();
		$this->document_store_id = $id;		
	}
	
	public function delete($documentStoreId) {
		// delete from documents
		$sql = "DELETE FROM document WHERE document_store_id = $documentStoreId";
		$this->_execute($sql);
		
		// delete from document_store
		$sql = "DELETE FROM document_store WHERE document_store_id = $documentStoreId";
		$this->_execute($sql);
	}
	
	public function addNewDocumentStore($medicalRecordId){
		$data = array (
			'medical_record_id' => $medicalRecordId
		);
		$this->populateArray($data);
		$this->persist();
		return $this->document_store_id;
	}

} // end of Document Store

?>
